#include <iostream>
#include <memory>
using namespace std;

void DeleteIntPtr(int *p) {
    cout << "call DeleteIntPtr" << endl;
    delete p;
}

int main() {
    shared_ptr<int> p(new int(1), DeleteIntPtr);
    shared_ptr<int> p2(new int(1), [](int *p) { 
        cout << "call lamada1 delete p" << endl;
        delete p; });
    shared_ptr<int> p3(new int[10], [](int *p) {
        cout << "call lamada2 delete[] p" << endl;
        delete[] p; // 删除数组
    });
    return 0;
}

/*
call lamada2 delete[] p
call lamada1 delete p
call DeleteIntPtr
*/